package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.PermissionBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface IPermissionMapper extends BaseMapper<PermissionBean> {
    /**
     * 通过角色id数组查询角色权限,同时去除重复的权限
     * @param roleIdArray 角色ID数组
     * @return 权限集合
     */
    List<PermissionBean> findByRoleIdArray(@Param("roleIdArray") Integer[] roleIdArray);

    /**
     * 根据角色id和权限id数组，添加权限-角色中间表
     * @param roleId        角色ID
     * @param permissionArray   权限id数组
     */
    void addPermissionByRoleId(@Param("roleId") Integer roleId,
                               @Param("permissionArray") Integer... permissionArray);
}
